package org.xtense.rcp.util;

import java.util.List;
import java.util.ArrayList;

import org.eclipse.swt.graphics.Image;

public class TreeEntry implements ITreeEntry {
	private String name = "";
	private ITreeEntry parentEntry;
	private List<ITreeEntry> children = new ArrayList<ITreeEntry>();
	private Image image;

	public TreeEntry() {

	}

	public TreeEntry(String name) {
		this.name = name;
	}

	@Override
	public void addChild(ITreeEntry entry) {
		entry.setParentEntry(this);
		children.add(entry);
	}

	@Override
	public List<ITreeEntry> getChildren() {
		return children;
	}

	@Override
	public String getName() {
		return name;
	}

	@Override
	public ITreeEntry getParentEntry() {
		return parentEntry;
	}

	@Override
	public boolean hasChild() {
		return children.size() > 0;
	}

	@Override
	public void setChildren(List<ITreeEntry> children) {
		this.children = children;
	}

	@Override
	public void setName(String name) {
		this.name = name;
	}

	@Override
	public void setParentEntry(ITreeEntry parentEntry) {
		this.parentEntry = parentEntry;
	}

	public Image getImage() {
		return image;
	}

	public void setImage(Image image) {
		this.image = image;
	}

}
